//
//  DHBaseClassView.m
//  发;fjag
//
//  Created by 刘鹏飞 on 2016/11/14.
//  Copyright © 2016年 刘鹏飞. All rights reserved.
//

#import "DHBaseClassView.h"
#import "XHHAdditions.h"
#import <Masonry.h>

@interface DHBaseClassView ()

@property (nonatomic,weak)UILabel *choseLabel;


@end

@implementation DHBaseClassView


/**
 构造方法
 */
+(instancetype)baseClass{
    
    //-------疾病分类视图--------//
    DHBaseClassView *classView = [[DHBaseClassView alloc] init];
    
    //创建子控件
    UILabel *classLabel = [UILabel XHH_labelWithText:@"疾病类型" fontSize:15 color:[UIColor blackColor]];
    UILabel *choseLabel = [UILabel XHH_labelWithText:@"请选择" fontSize:13 color:[UIColor lightGrayColor]];
    classView.choseLabel = choseLabel;
    UIButton *accessoryBtnOne = [[UIButton alloc] init];
    [accessoryBtnOne setImage:[UIImage imageNamed:@"position-right"] forState:UIControlStateNormal];
    UIView *sepLineView = [[UIView alloc] init];
    sepLineView.backgroundColor = [UIColor XHH_colorWithHex:0xf9f9f9];
    
    //添加都父控件
    [classView addSubview:accessoryBtnOne];
    [classView addSubview:classLabel];
    [classView addSubview:choseLabel];
    [classView addSubview:sepLineView];
    
    //布局子控件
    [accessoryBtnOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.bottom.equalTo(classView);
        make.width.mas_equalTo(40);
    }];
    [classLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(classView);
        make.left.equalTo(classView).offset(8);
    }];
    [choseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(classLabel);
        make.right.equalTo(accessoryBtnOne.mas_left).offset(-8);
    }];
    [sepLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.right.left.equalTo(classView);
        make.height.mas_equalTo(1);
    }];
    
    return classView;
}


-(void)setDiseaseClass:(NSString *)diseaseClass {
    _diseaseClass = diseaseClass;
    self.choseLabel.text = diseaseClass;
}


@end
